<?php

/**
 * Pwiff - PHP SWF Library
 *
 * LICENSE
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @package    Pwiff
 * @subpackage Tags
 * @copyright  Copyright (c) 2010 Steven Harris
 * @license    http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @version    $Id: SetBackgroundColor.php 8 2010-02-22 04:06:23Z indigo.sunrise $
 */

/**
 * Represents the SetBackgroundColor tag.
 *
 * @package    Pwiff
 * @subpackage Tags
 */
class Pwiff_Tag_SetBackgroundColor extends Pwiff_Tag
{
	/**
	 * SetBackgroundColor tag type.
	 *
	 * @var int
	 */
	protected $pwiffTag = 9;
	
	/**
	 * The background color.
	 * 
	 * @var Pwiff_Record_RGB
	 */
	protected $color = null;
	
	/**
	 * Sets the background color.
	 *
	 * @param  Pwiff_Record_RGB $color
	 * @return Pwiff_Tag_SetBackgroundColor
	 */
	public function setColor(Pwiff_Record_RGB $color)
	{
		$this->color = $color;
		return $this;
	}
	
	/**
	 * Gets the background color.
	 * 
	 * @return Pwiff_Record_RGB
	 */
	public function getColor()
	{
		return $this->color;
	}
	
	/**
	 * Returns the data length for the SetBackgroundColor tag. Always 3.
	 *
	 * @return int
	 */
	public function getTagLength()
	{
		return 3;
	}
	
	/**
	 * Writes the SetBackgroundColor tag to the given output instance.
	 * 
	 * @param  Pwiff_Output $out
	 */
	public function write(Pwiff_Output $out)
	{
		parent::write($out);
		$this->color->write($out);
	}
}
